import cv2 as cv 
from skimage import transform,util  
import numpy as np  
import matplotlib.pyplot as plt 

img=cv.imread('./img/2.jpg',cv.IMREAD_COLOR)
img=cv.cvtColor(img,cv.COLOR_BGR2RGB)#BGR转RGB色彩空间
rows,cols=img.shape[0:2]
matrotate = cv.getRotationMatrix2D(center=(cols/2,rows/2),angle=45,scale=1)

imgdst1 = cv.warpAffine(img,matrotate,dsize=(cols,rows),borderValue=(200,200,200))

imgdst2 = transform.rotate(img,45,resize=True,cval=0.5)
imgdst2= util.img_as_ubyte(imgdst2)

plt.imshow(imgdst1)
plt.imshow(imgdst2)
plt.show()
